package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CheckItemMapper {

    /**
     * 分页查询
     * @param queryString
     * @return
     */
    Page<CheckItem> pageQuery(String queryString);

    /**
     * 添加检查项
     * @param checkItem
     */
    @Insert("insert into t_checkitem (code, name, sex, age, price, type, attention, remark) " +
            "VALUES (#{code},#{name},#{sex},#{age},#{price},#{type},#{attention},#{remark})")
    void insert(CheckItem checkItem);

    /**
     * 根据id删除检查项
     * @param id
     */
    @Delete("delete from t_checkitem where id = #{id}")
    void deleteById(Integer id);

    /**
     * 根据条件查询
     * @param checkItem
     * @return
     */
    List<CheckItem> select(CheckItem checkItem);

    /**
     * 更新检查项
     * @param checkItem
     */
    void update(CheckItem checkItem);

    /**
     * 根据ids批量查询检查项
     * @param checkitemIds
     * @return
     */
    List<CheckItem> selectBatchByIds(List<Integer> checkitemIds);
}
